package com.party.course.controller;


import java.util.Arrays;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.party.common.annotation.Log;
import com.party.common.core.controller.BaseController;
import com.party.common.core.domain.AjaxResult;
import com.party.common.enums.BusinessType;
import com.party.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.party.course.domain.WageInfo;
import com.party.course.service.IWageInfoService;
import com.party.common.core.page.TableDataInfo;

/**
 * 工资管理Controller
 *
 * @author ruoyi
 * @date 2025-05-29
 */
@RestController
@RequestMapping("/course/Wage" )
public class WageInfoController extends BaseController {
    @Autowired
    private IWageInfoService wageInfoService;

/**
 * 查询工资管理列表
 */
//@RequiresPermissions("course:Wage:list")
@GetMapping("/list" )
    public TableDataInfo list(WageInfo wageInfo) {
        startPage();
        List<WageInfo> list = wageInfoService.findList(wageInfo);
        return getDataTable(list);
    }

    /**
     * 导出工资管理列表
     */
    //@RequiresPermissions("course:Wage:export")
    @Log(title = "工资管理" , businessType = BusinessType.EXPORT)
    @PostMapping("/export" )
    public void export(HttpServletResponse response, WageInfo wageInfo) {
        List<WageInfo> list = wageInfoService.findList(wageInfo);
        ExcelUtil<WageInfo> util = new ExcelUtil<WageInfo>(WageInfo. class);
        util.exportExcel(response, list, "工资管理数据" );
    }

    /**
     * 获取工资管理详细信息
     */
    //@RequiresPermissions("course:Wage:query")
    @GetMapping(value = "/view/{id}" )
    public AjaxResult getInfo(@PathVariable("id" ) String id) {
        return AjaxResult.success(wageInfoService.view(id));
    }

    /**
     * 新增工资管理
     */
    //@RequiresPermissions("course:Wage:add")
    @Log(title = "工资管理" , businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody WageInfo wageInfo) {
        return toAjax(wageInfoService.add(wageInfo));
    }

    /**
     * 修改工资管理
     */
    //@RequiresPermissions("course:Wage:edit")
    @Log(title = "工资管理" , businessType = BusinessType.UPDATE)
    @PutMapping("/update")
    public AjaxResult edit(@RequestBody WageInfo wageInfo) {
        return toAjax(wageInfoService.updateEntity(wageInfo));
    }

    /**
     * 删除工资管理
     */
    //@RequiresPermissions("course:Wage:remove")
    @Log(title = "工资管理" , businessType = BusinessType.DELETE)
    @DeleteMapping("/delete/{ids}" )
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(wageInfoService.deleteIds(Arrays.asList(ids)));
    }
}
